<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<script type="text/javascript">
		var aJaxURL = "server-side/hall/hall.action.php";		//server side folder url
		var seoyURL = "server-side/seoy/seoy.action.php";	    //server side folder url
		var tName 	= "pos-table";								//table name
		var fName 	= "pos-form";								//form name	
		var menuLength = [[100], [100]];
		var dialogButton = {
	        "save": {
	            text: "არჩევა",
	            id: "save-pos-select",
	            click: function () {
	            }
	        }
	    };
		var oID		= 0;
		
		$(document).ready(function (){
			AjaxSetup1();
			SelectPOS();
			GetDialog("pos-select-form", 480, "auto", dialogButton);

			SeoY("seoy-input", seoyURL, "pos", "", 1) ;
			
			$("#navigate").hide();
			$("#pos-wrapper").hide();
			
			$("#seoy_button").button({
	            icons: {
	                primary: "ui-icon-check"
	            }
        	});
												
			$("#save_trans_button").button({
	            icons: {
	                primary: "ui-icon-disk"
	            }
        	});
        	
			$("#save_button").button({
	            icons: {
	                primary: "ui-icon-disk"
	            }
        	});
        	
			$("#cancel_button").button({
	            icons: {
	                primary: "ui-icon-closethick"
	            }
        	});
        	    	
			$("#add_payment").button({
	            icons: {
	                primary: "ui-icon-check"
	            }
        	});

			$("#terminal_payment").button({
	            icons: {
	                primary: "ui-icon-calculator"
	            }
        	});

			$("#add_money").button({
	            icons: {
	                primary: "ui-icon-circle-plus"
	            }
        	});

			$("#take_money").button({
	            icons: {
	                primary: "ui-icon-circle-minus"
	            }
        	});
        	
			$("#print_button").button({
	            icons: {
	                primary: "ui-icon-print"
	            }
        	});

			GetMainMenu();

			//on number change send requests to get auto number history
			
			$("#quantity").keyboard({

				 display: {
				  'bksp'   : '\u2190',
				  'enter'  : 'return',
				  'default': 'ABC',
				  'accept' : '\u21d3'
				 },

				 layout: 'custom',

				 customLayout: {

				  'default': [
				   '1 2 3',
				   '4 5 6',
				   '7 8 9',
				   '0 {bksp} {accept}'
				  ]
				 }

			});



		});



		function SelectPOS(){
			$.ajax({
				url: aJaxURL,
				data: "act=select_pos",       
				success: function(data) {
					if (typeof (data.error) != "undefined") {
                        if (data.error != "") {
                            alert(data.error);
                        } else {
                        	$("#pos-select-form").html(data.page);

                			$("#dont-confirm-pos").button({
                        	});	
                			$("#dont-confirm-pos").click(function(){
                    			
                				$("#check-failed").css("visibility","visible");
                			});                   
                        }
                    }
				}
			});
		}
		
		function LoadDialog(){		
		    $("#" + fName).dialog({
		        resizable:     false,
		        draggable:     false,		       
		        width:         1035,
		        height:        860,
		        modal:         false,
		        stack:         true,
                sticky:        false,
                closeOnEscape: false,
                dialogClass:   "pos-dialog"
		    });
		}
		
		function LoadTable(){
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
			GetDataTable(tName, aJaxURL, "get_list", 5, "obj_id=" + oID, 0, menuLength, 0, "asc");					
		}


		$(document).on("click", "#save-pos-select", function() {		
			oID		= $("#obj_id :selected").val();
			oName	= $("#obj_id :selected").text();
			$("#" + fName).attr("title", oName);
			
			LoadDialog();
			LoadTable();
			
			GetQuantity(oID);
			GetSumPrice(oID);
			
			$("#pos-wrapper").fadeIn("slow");
			$("#seoy-input").focus();
			$("#pos-select-form").dialog("close");


			if($("#pos_money_amount").val()){
				var obj_id = oID;
				var money_amount  = $("#pos_money_amount").val();
				var comment       = $("#reason").val();
				var money         = $("#pos-money").text();
				
				$.ajax({
					url: aJaxURL,
					data: "act=pos-check&obj_id=" + obj_id + "&money-amount=" + money_amount + "&comment=" + comment,
					success: function(data) {
						if (typeof (data.error) != "undefined") {
	                        if (data.error != "") {
	                            alert(data.error);
	                        } else { 
	                        //	PrintSalary(obj_id, money);
	                        }
	                    }
					}
				});
			}
		});

		$(document).on("click", "#save_button", function() {	
			var obj_id	= oID;
			
			$.ajax({
				url: aJaxURL,
				data: "act=save_transaction&obj_id=" + obj_id,
				success: function(data) {
					if (typeof (data.error) != "undefined") {
                        if (data.error != "") {
                            alert(data.error);
                        } else {
    						GetQuantity(obj_id);
    						GetSumPrice(obj_id);
    						LoadTable();
    						alert("ტრანზაქცია შენახულია!");
                        }
                    }
				}
			});
		});

		$(document).on("click", "#cancel_button", function() {

			var obj_id	= oID;
			var col =  parseInt($("tr.odd").text());
			
			if(!isNaN(col)){
				$.ajax({
					url: aJaxURL,
					data: "act=abort_transaction&obj_id=" + obj_id,        
					success: function(data) {
						if (typeof (data.error) != "undefined") {
	                        if (data.error != "") {
	                            alert(data.error);
	                        } else {
	    						GetQuantity(obj_id);
	    						GetSumPrice(obj_id);						
	    						LoadTable();
	    						alert("ტრანზაქცია წარმატებით გაუქმდა!");
	                        }
	                    }
					}
				});
	      }
		});

		$(document).on("click", ".pos-prod-delete", function() {
			var trans_id  = $(this).text();
			var obj_id	= oID;
			
			$.ajax({
				url: aJaxURL,
				data: "act=delete_prod&trans_id=" + trans_id + "&obj_id=" + obj_id,        
				success: function(data) {
					if (typeof (data.error) != "undefined") {
                        if (data.error != "") {
                            alert(data.error);
                        } else {
    						GetQuantity(obj_id);
    						GetSumPrice(obj_id);
    						LoadTable();
                        }
                    }
				}
			});
		});

		$(document).on("click", "#add_money", function() {	
			var obj_id	= oID;

			
			$.ajax({
				url: aJaxURL,
				data: "act=add-money-page&obj_id=" + obj_id,       
				success: function(data) {
					if (data.error != "") {
                        alert(data.error);
                    } else {
	                	$("#money_transfer").html(data.page);
                    }
				}
			});
	
			
			var button = {
			        "save": {
			            text: "დამატება",
			            id: "add_money_salary",
			            click: function () {
			            }
			        },	
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			                $(this).dialog("close");
			            }
			        }
			    };
			GetDialog("money_transfer", 541, "auto", button);			
		});
		

	$(document).on("click", "#add_money_salary", function() {	
			var obj_id       =  oID;	
			var money_amount =  parseFloat($("#money-amount").val());
			var comment      =  $("#notice").val();
			var username     =  $("#username").val();
			var password     =  $("#password").val();
			
			if(confirm("დარწმუნებული ხართ?")){
				$.ajax({
					url: aJaxURL,
					data: "act=add-money&obj_id=" + obj_id + "&money-amount=" + money_amount + "&comment=" + comment + "&username=" + username + "&password=" + password,       
					success: function(data) {
						if (data.error != "") {
	                        alert(data.error);
	                    } else {
	                    	$("#money_transfer").dialog("close");
	                    }
					}
				});
			}
			
	});

	$(document).on("click", "#take_money", function() {	
			var obj_id	= oID;

			
			$.ajax({
				url: aJaxURL,
				data: "act=take-money-page&obj_id=" + obj_id,       
				success: function(data) {
					if (data.error != "") {
                        alert(data.error);
                    } else {
	                	$("#money_transfer").html(data.page);
                    }
				}
			});
	
			
			var button = {
			        "save": {
			            text: "გატანა",
			            id: "take_money_salary",
			            click: function () {
			            	 
			            }
			        },	
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			                $(this).dialog("close");
			            }
			        }
			    };
			GetDialog("money_transfer", 541, "auto", button);

		});	

	$(document).on("click", "#take_money_salary", function() {	
		var obj_id       =  oID;	
		var money_amount =  parseFloat($("#take-money-amount").val());
		var comment      =  $("#take-notice").val();
		var username     =  $("#username").val();
		var password     =  $("#password").val();

		if(confirm("დარწმუნებული ხართ?")){
			$.ajax({
				url: aJaxURL,
				data: "act=take-money&obj_id=" + obj_id + "&money-amount=" + money_amount + "&comment=" + comment + "&username=" + username + "&password=" + password,       
				success: function(data) {
					if (data.error != "") {
	                    alert(data.error);
	                } else {
	                	$("#money_transfer").dialog("close");
	                }
				}
			});
		}
		
	});		

		$(document).on("click", "#add_payment", function() {		
				MakePayment();
		});

		$(document).on("click", "#terminal_payment", function() {		
			MakeTerminalPayment();
		});

		$(document).on("keypress", "#sum-total-price", function(e) {

			if(e.which == 13){		
				MakePayment();
			}
		});

		$(document).on("keyup", "#sum-total-price", function() {
		    var val = $(this).val();
		    if(isNaN(val)){
		         val = val.replace(/[^0-9\.]/g,'');
		         if(val.split('.').length>2) 
		             val =val.replace(/\.+$/,"");
		    }
		    $(this).val(val); 
		    
			var change = parseFloat((parseFloat($("#sum-total-price").val()) - parseFloat($("#sum-price").text()))).toFixed(2);
			if(change > 0){
			$("#change").text(change);
			}else{
				$("#change").text("0.00");
			}
			
		});

		$(document).on("keypress", "#seoy-input", function() {
			if ( event.which == 13 ) {
				$("#seoy_button").click();
				$("#seoy-input").autocomplete("close");
			}
		});

		$(document).on("click", "#save_trans_button", function() {	
			var obj_id	= oID;
						
			$.ajax({
				url: aJaxURL,
				data: "act=suspended_page&obj_id=" + obj_id,       
				success: function(data) {
					if (data.error != "") {
                        alert(data.error);
                    } else {
	                	$("#pos-transactions-form").html(data.page);
	          			$( ".restore_suspend_button" ).button({
	        			      icons: {
	        			        primary: "ui-icon-arrowreturnthick-1-s"
	        			      }
	        			});
	          			$( ".cancel_suspend_button" ).button({
	        			      icons: {
	        			        primary: "ui-icon-trash"
	        			      }
	        			});
                    }
				}
			});
			
			var button = {
		        "cancel": {
		            text: "დახურვა",
		            id: "cancel-dialog",
		            click: function () {
		                $(this).dialog("close");
		            }
		        }
		    };
		    
			GetDialog("pos-transactions-form", 600, "auto", button);
		});

		
		
		$(document).on("click", ".restore_suspend_button", function() {
			var obj_id	= oID;
			var trans_id = $(this).attr("trans");
			
			$.ajax({
				url: aJaxURL,
				data: "act=restore_suspended&obj_id=" + obj_id + "&trans_id=" + trans_id,       
				success: function(data) {
					if (data.error != "") {
                        alert(data.error);
                    } else {
						GetQuantity(obj_id);
						GetSumPrice(obj_id);
						LoadTable();
	                	$("#pos-transactions-form").dialog("close");
                    }
				}
			});
		});
		
		$(document).on("click", ".cancel_suspend_button", function() {
			var obj_id	= oID;
			var trans_id = $(this).attr("trans");

			if(confirm("დარწმუნებული ხართ რომ გსურთ ტრანზაქციის წაშლა?")){
				$.ajax({
					url: aJaxURL,
					data: "act=cancel_suspend&trans_id=" + trans_id,       
					success: function(data) {
						if (data.error != "") {
	                        alert(data.error);
						} else {
		                	$("#pos-transactions-form").dialog("close");
	                    }
					}
				});
			}
		});
		
		function GetMainMenu(){
			$.ajax({
				url: aJaxURL,
				data: "act=get_main_menu",     
				success: function(data) {
					if (typeof (data.error) != "undefined") {
                        if (data.error != "") {
                            alert(data.error);
                        } else {
                        	$("#main_menu").html(data.page);	
                        }
                    }
				}
			});
		}
		
		$(document).on("click", ".main", function() {
			var id = $(this).attr("id");

			$.ajax({				
				url: aJaxURL,
				data: "act=get_sub_menu&id=" + id,      
				success: function(data) {
					if (typeof (data.error) != "undefined") {
                        if (data.error != "") {
                            alert(data.error);
                        } else {
                        	$("#main_menu").html(data.page);        	
                        }
                    }
				}
			});
			
		});
		
		//click on production
		
		$(document).on("click", ".productions", function() {
				
			var obj_id	= oID;
			var prod_id = $(this).attr("id");
			
			$.ajax({
				url: aJaxURL,
				data: "act=prod_ing_page&obj_id=" + obj_id + "&prod_id=" + prod_id,       
				success: function(data) {
					if (data.error != "") {
                        alert(data.error);
                    } else {
	                	$("#pos-production-form").html(data.page);							 				 
	                	RecipieSpinner();
                    }
				}
			});
			
			var button = {
		        "save": {
		            text: "დამატება",
		            id: "save-dialog",
		            click: function () {
		            }
		        },	
		        "cancel": {
		            text: "დახურვა",
		            id: "cancel-dialog",
		            click: function () {
		                $(this).dialog("close");
		            }
		        }
		    };
		    
			GetDialog("pos-production-form", 541, "auto", button);

	});	

		
  //click on production
		
	$(document).on("click", ".production_name_hall", function() {
				
			var obj_id	= oID;
			var prod_id = $(this).attr("id");
			
			$.ajax({
				url: aJaxURL,
				data: "act=prod_ing_page&obj_id=" + obj_id + "&prod_id=" + prod_id,       
				success: function(data) {
					if (data.error != "") {
                        alert(data.error);
                    } else {
	                	$("#pos-production-form").html(data.page);							 				 
	                	RecipieSpinner();
                    }
				}
			});
			
			var button = {
		        "save": {
		            text: "დამატება",
		            id: "save-dialog",
		            click: function () {
		            }
		        },	
		        "cancel": {
		            text: "დახურვა",
		            id: "cancel-dialog",
		            click: function () {
		                $(this).dialog("close");
		            }
		        }
		    };
		    
			GetDialog("pos-production-form", 541, "auto", button);

	});	
	
//click on production
	
	$(document).on("click", ".production_price_hall", function() {
			
		var obj_id	= oID;
		var prod_id = $(this).attr("id");
		
		$.ajax({
			url: aJaxURL,
			data: "act=prod_ing_page&obj_id=" + obj_id + "&prod_id=" + prod_id,       
			success: function(data) {
				if (data.error != "") {
                    alert(data.error);
                } else {
                	$("#pos-production-form").html(data.page);							 				 
                	RecipieSpinner();
                }
			}
		});
		
		var button = {
	        "save": {
	            text: "დამატება",
	            id: "save-dialog",
	            click: function () {
	            }
	        },	
	        "cancel": {
	            text: "დახურვა",
	            id: "cancel-dialog",
	            click: function () {
	                $(this).dialog("close");
	            }
	        }
	    };
	    
		GetDialog("pos-production-form", 541, "auto", button);

	});				
		// save button
	    $(document).on("click", "#save-dialog", function () {
		    	param = new Object();	    	
	            //Action
		    	obId	= $("#obj_id :selected").val();
		    	
		    	param.act			= "add_prod";		

		    	param.obj_id		= $("#obj_id :selected").val();
			    param.id         	= $("#prod_id").html();
			   	param.quantity		= $("#prod_quantity").val();
			   	param.price			= 0;

			   	/*  ARRAY OF PRODUCTION */
			    var array = new Array();
			    
			
		    	$("tr.trCheckClass1").each(function(){
					$this = $(this)
				    var value = $this.find("span.id_value").html();				    
		    		array.push(Array($("#type_"+value).text(), $("#quantity_"+value).val(), $("#ingr_quantity_"+value).val()));
		    	});
		    	param.list	= JSON.stringify(array);
				var checkedArray = myEmptyArray(array);
				
				if(!checkedArray && !empty(array)){
					alert("ყველა ინგრედიენტის რაოდენობაა 0 !")
				}else {
						
				    $.ajax({
				        url: aJaxURL,
					    data: param,
				        success: function(data) {
							if(typeof(data.error) != "undefined")
							{
								if(data.error != "")
								{
									alert(data.error);
								}else
								{
									GetQuantity(obId);
									GetSumPrice(obId);
									LoadTable("pos-container-table");
					        		CloseDialog("pos-production-form");			        		
								}
							}
					    }
				    });
				}
			});

		

		$(document).on("click", "#backTop", function() {
			GetMainMenu();		
		});

		function GetQuantity(obj_id){
			$.ajax({
				url: aJaxURL,
				data: "act=get_prod_count&obj_id=" + obj_id,        
				success: function(data) {
					if (typeof (data.error) != "undefined") {
                        if (data.error != "") {
                            alert(data.error);
                        } else {
                            if(empty(data.prod_count))
                        		$("#prod-quantity").text(0);
                            else
                        		$("#prod-quantity").text(data.prod_count);
                        }
                    }
				}
			});
		}		
				
		function GetSumPrice(obj_id){
			$.ajax({
				url: aJaxURL,
				data: "act=get_sum_price&obj_id=" + obj_id,        
				success: function(data) {
					if (typeof (data.error) != "undefined") {
                        if (data.error != "") {
                            alert(data.error);
                        } else {
                            if(empty(data.sum_price)){
        						$("#sum-price").text("00.00");
        						$("#sum-total-price").val("00.00");
                            } else{
        						$("#sum-price").text(data.sum_price);
        						$("#sum-total-price").val(data.sum_price);
        						$("#sum-total-price").select();
                            }
                        }
                    }
				}
			});
		}

		function myEmptyArray(array) {
		    for(var i = 0; i < array.length; i++) {
		        if(array[i][1] != 0) {
		            return true;
		        }
		    }
		    return false;
		}

		$(document).on("click", "#print_button", function () {
	    	param = new Object();
	    	
            //Action
		    param.id	 = $("#obj_id :selected").val();
		    param.status = 1;
	    	var link = $(this).attr("str");
	    	link = "server-side/print/print.action.php?id=" + param.id + "&status=" + param.status;
	    	
	    	var newWin = window.open(link, "JSSite", "width=800,height=800,resizable=yes,scrollbars=yes,status=yes");
	    	newWin.focus();
	    	newWin.onload = function() {
	    		newWin.print();
	    		setInterval(function(){newWin.close()},500);
		    }
	    });

	    function RecipieSpinner(){		    
		    $("tr.trCheckClass1").each(function() {
			       $this     = $(this);
				   var value = $this.find("span.id_value").html();
				    
					if(($("#ingr_quantity_"+value).val()) ==  0){
							 $("#quantity_" + value).val(0);
					}
					
				   $("#increment_" + value).click(function(){ 
							$("#quantity_" + value).val(parseFloat($("#ingr_quantity_" + value).val() *  $("#id_quantity_" + value).val()*100/100).toFixed(3));				 
				    });
				   
				   $("#decrement_" + value).click(function(){ 
					   	
						 if( $("#ingr_quantity_" + value).val() !=0 ){
							  $("#quantity_" + value).val(parseFloat($("#ingr_quantity_" + value).val() *  $("#id_quantity_" + value).val()*100/100).toFixed(3));
						 } else {				
							     $("#quantity_" + value).val(0);
							    }									
				    }); 					 
			  });
	    }
	    
		
	    function printCheck(price){
 	    	param       = new Object();
 		    param.act   = "print_check";

 		    param.price = price;
				
			$.ajax({
				url: aJaxURL,
				data: param,        
				success: function(data) {
					if (typeof (data.error) != "undefined") {
                        if (data.error != "") {
                            alert(data.error);
                        } else {

                        	var el = document.getElementById('bt1');
                        	if (document.createEvent) {
                        	    var event = document.createEvent("MouseEvents");
                        	    event.initEvent("click", true, true);
                        	    el.dispatchEvent(event);
                        	}
                        	
                       }
                    }
				}
			});		    
	    }

	    function MakePayment(){
			var sum			= parseFloat($("#sum-price").text());
			var total_sum	= parseFloat($("#sum-total-price").val());
			//var trans_id    = $(this).attr("trans");
			var pay_type    = 1;

			if(confirm("დარწმუნებული ხართ, რომ გსურთ გადახდა?")){			
				if(parseInt($('#pos-table tbody tr td').children().length) === 0){
					alert("პროდუქტების  სია ცარიელია!");
				} else{
				if(total_sum < sum || isNaN(total_sum)){
					alert("თანხა არასაკმარისია!");
				}else {		
						var obj_id	= oID;
						
						$.ajax({
							url: aJaxURL,
							data: "act=payment_done&obj_id=" + obj_id + "&payed_money=" + total_sum + "&pay_type=" + pay_type,        
							success: function(data) {
								if (typeof (data.error) != "undefined") {
			                        if (data.error != "") {
			                            alert(data.error);
			                        } else {
										GetQuantity(obj_id);
										GetSumPrice(obj_id);
										LoadTable();
										$("#sale_price").val(0);
										$("#seoy-input").val("");
										$("#change").text("0.00");								
										printCheck(sum);
			                        }
			                    }
							}
						});
				}
			  }
			}
	    }

	    function MakeTerminalPayment(){
			var sum			= parseFloat($("#sum-price").text());
			var total_sum	= parseFloat($("#sum-total-price").val());
			//var trans_id    = $(this).attr("trans");
			var pay_type    = 2;

			if(confirm("დარწმუნებული ხართ, რომ გსურთ გადახდა?")){
				if(parseInt($('#pos-table tbody tr td').children().length) === 0){
					alert("პროდუქტების  სია ცარიელია!");
				} else{
				if(total_sum < sum || isNaN(total_sum)){
					alert("თანხა არასაკმარისია!");
				}else {		
						var obj_id	= oID;
						
						$.ajax({
							url: aJaxURL,
							data: "act=payment_done&obj_id=" + obj_id + "&payed_money=" + total_sum + "&pay_type=" + pay_type,        
							success: function(data) {
								if (typeof (data.error) != "undefined") {
			                        if (data.error != "") {
			                            alert(data.error);
			                        } else {
										GetQuantity(obj_id);
										GetSumPrice(obj_id);
										LoadTable();
										$("#sale_price").val(0);
										$("#seoy-input").val("");	
										$("#change").text("0.00");							
			                        }
			                    }
							}
						});
				}
			  }
			}
	    }

		$(document).on("keypress", "#seoy-input", function() {
			if ( event.which == 13 ) {
				DoSeo();
			}
		});

		function DoSeo(){
			param = new Object();
			
            //Action
            param.act	= "add_prod_seo";
            
            param.name		= $("#seoy-input").val();
            param.obj_id	= oID;
            param.trans_id 	= $("#trans_id_hidden").val();	
            //param.price		= $("#sale_price").val();
			
			$.ajax({
				url: aJaxURL,
				data: param,
				success: function(data) {
					if (typeof (data.error) != "undefined") {
                        if (data.error != "") {
                            alert(data.error);
                        } else {
    						GetQuantity(param.obj_id);
    						GetSumPrice(param.obj_id);
    						LoadTable();
    						$("#seoy-input").autocomplete("close");
    						$("#seoy-input").val("");
    						//$("#sale_price").val(0);
    						//$("#seoy-input").val("");
                        }
                    }
				}
			});
		}
	    
		

		function PrintSalary(obj_id, money){
	    	param = new Object();
	    	
            //Action
		    param.id	 = obj_id;
		    param.money  = money;

	    	var link = $(this).attr("str");
	    	link = "server-side/print/print_salary.php?id=" + param.id + "&money=" + money;
	    	
	    	var newWin = window.open(link, "JSSite", "width=800,height=800,resizable=yes,scrollbars=yes,status=yes");
	    	newWin.focus();
	    	newWin.onload = function() {
	    		newWin.print();
	    		setInterval(function(){newWin.close()},500);
		    }
		}

		$(document).on("keyup", "#money-amount, #take-money-amount, #pos_money_amount", function() {
		    var val = $(this).val();
		    if(isNaN(val)){
		    	alert("მოცემულ ველში შეიყვანეთ მხოლოდ ციფრები");
		         val = val.replace(/[^0-9\.]/g,'');
		         if(val.split('.').length>2) 
		             val =val.replace(/\.+$/,"");
		    }
		    $(this).val(val); 
		});	    
	</script>
	
	<style type="text/css">
		.dataTable_buttons{
			display: none;
		}
	</style>
</head>
<body onselectstart='return false;' ondragstart='return false';>
	<a  style="display: none;" id="bt1" href="media/print/DEFEXEC.txt" download>link</a>
	<div id="pos-wrapper">
	    <!-- jQuery Dialog -->
	    <div id="pos-select-form" class="form-dialog" title="სალაროს არჩევა">
	    </div>
	    <!-- jQuery Dialog -->
	    <div id="pos-transactions-form" class="form-dialog" title="შეჩერებული ტრანზაქციები">
	    </div>
	     <!-- jQuery Dialog -->
	    <div id="pos-production-form" class="form-dialog" title="პროდუქტი">
	    </div>
	    <!-- jQuery Dialog -->
	    <div id="money_transfer" class="form-dialog" title="თანხის მოძრაობა">
	    </div>	    
	    
	    <div id="pos-form" style="overflow:hidden">
	    	<table id="pos-container-table">
	    		
				<tr>
					<td>
						<div id="product-wrapper" class="fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix" style="width: 450px !important;">
							<div id="pos-seoy">
					           	<input id="seoy-input" type="text" name="seoy-input" style="width:335px;">
					           	<button id="seoy_button" style="padding: 15px 0px 5px 0px;"><span style="display:none;">დ</span></button>
							</div>
						
							 <div class="pos-inner-table">
							    <div id="dt_example" class="ex_highlight_row">
						            <div id="dynamic">
						                <table class="display" id="pos-table">
						                    <thead>
						                        <tr id="datatable_header">
						                   			<th>ID</th>
						                            <th width="100%">დასახელება</th>
						                            <th width="70px">ფასი</th>
						                            <th width="50px">რაოდ.</th>
						                            <th width="70px">ჯამი</th>
						                            <th class="check"></th>
						                        </tr>
						                    </thead>
						                </table>
						            </div>
						    	</div>
						    </div>
						</div>
						<div class="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix" id="pos-table-footer"></div>
					</td>
					<td width="8">&nbsp;</td>	
					<td><div id="main-menu-container" style="width: 565px; height:605px; position:relative; overflow-x: scroll;"> 
							<table id="main_menu" style="width: 548px;" class="tableClassHall">							
							</table>
						</div>
					</td>	
				</tr>
				
				<tr id="pos-table-header"  style="padding-left: 0px !important; height:20px !improtant;">					
					<td style="height:20px !important;">
						<button id="save_trans_button" class="buttons" style="margin-left:2px !important; width:110px !important"><span><p>ტრანზ.</p></span></button>
						<button id="save_button" style="width:115px !important;" class="buttons"><span><p>შენახვა</p></span></button>
						<button id="cancel_button" class="buttons" style="width:100px !important;"><span><p>გაუქმ.</p></span></button>
						<button id="print_button" class="buttons" style="width:100px !important;"><span><p>ბეჭდვა</p></span></button>
					</td>
					<td></td>
					<td>
				
					</td>
		
				</tr>

				<tr>
					<td style="height:20px !important;">
						<div id="sale_details" style="float: left;">
							<table id="sales_items">
								<tr>
									<td class="left" style="height: 40px !important;"><pre style="font-size: 16px; margin-top: 8px;">რაოდენობა:        <span id="prod-quantity">0</span> ც</pre></td>
								</tr>
							</table>
							<table id="sales_items_total">
								<tr>
									<td class="left" style="height: 40px !important;"><pre style="font-size: 16px; margin-top: 10px;">ჯამი:                	 <span id="sum-price">0.00</span> ლ</pre></td>
								</tr>
							</table>
						</div>						
						<div id="make_payment" style="float: left; margin-bottom: 0px; width:223px !important; border: 1px solid #C2C2C2;">
							<div id="pay_box">
								<input type="text" value="0.00" id="sum-total-price" size="10" style="font-size: 16px;" />
								<div id="label-change" style="display:inline; line-height:290%;">ხურდა:<span id="change" style="font-weight:bold;">0.00</span></span></div>
							</div>
							<div id="add_payment_button">
								<button id="add_payment">გადახდა</button>
								<button id="terminal_payment" style="width:90px;  padding: 4px 0;">ტერმ.</button>
							</div>
						</div>
					</td>
				</tr>
			</table>
			<table style="position:absolute; left:480px; top:660px;">
				<tr>
						<td>
							<button id="add_money" class="buttons" style="width:150px !important;"><p style="font-size:12px !important;">თანხის დამატება</p></button>
							<button id="take_money" class="buttons" style="width:150px !important;"><p style="font-size:12px !important;">თანხის გატანა</p></button>
						</td>
				</tr>
			</table>
		</div>
	</div>
</body>
</html>